package nautilus.moneykeeper.fragment;

import nautilus.moneykeeper.MainBaseSlidingActvity;
import nautilus.moneykeeper.R;
import nautilus.moneykeeper.SettingActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class HomeMenuFragment extends Fragment{
	private boolean isButtonClicking;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedState){
		View view = inflater.inflate(R.layout.home_left_menu, parent, false);
		return view;		
	}
	
	public void onResume(){
		isButtonClicking = false;
		super.onResume();
	}
	
	public void onMenuItemClicked(View v){
		switch(v.getId()){
			case R.id.home_menu_item_account:
				if(isButtonClicking)
					return;
				isButtonClicking = true;
			break;
			
			case R.id.home_menu_item_settings:
				if(isButtonClicking)
					return;
				isButtonClicking = true;
				SettingFragment settingFragment = new SettingFragment();
				//Bundle args = new Bundle();
				((MainBaseSlidingActvity)getActivity()).setMainFragment(settingFragment, 
						R.anim.slide_in_from_right, R.anim.slide_out_to_left);
				((MainBaseSlidingActvity)getActivity()).toggle();
				isButtonClicking = false;
			break;
				
			case R.id.home_menu_item_exit:
				if(isButtonClicking)
					return;
				isButtonClicking = true;
			break;
		}
	}
}
